package com.agritech.state;

import com.agritech.machine.AgriculturalMachineContext;

public class IdleState implements MachineState {
    @Override
    public void start(AgriculturalMachineContext machine) {
        System.out.println("农机 [" + machine.getMachineId() + "] 从空闲状态启动中...");
        machine.setState(new RunningState());
        machine.setFuelLevel(machine.getFuelLevel() - 1); // 启动消耗少量油
    }

    @Override
    public void stop(AgriculturalMachineContext machine) {
        System.out.println("农机 [" + machine.getMachineId() + "] 已经是空闲状态，无需停止。");
    }

    @Override
    public void work(AgriculturalMachineContext machine) {
        System.out.println("农机 [" + machine.getMachineId() + "] 处于空闲状态，无法直接作业，请先启动。");
    }

    @Override
    public void fix(AgriculturalMachineContext machine) {
        System.out.println("农机 [" + machine.getMachineId() + "] 处于空闲状态，可以进行检修。");
        machine.setState(new MaintenanceState());
    }

    @Override
    public String getStateName() {
        return "空闲";
    }
}